package neo4j.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import deepr.anno.*;
import deepr.handler.DistanceHandler;
import deepr.handler.SnowIdHandler;
import lombok.Data;

import java.util.List;

@Data
@Schema(name = "USER", type = SchemaType.NEO4J)
public class User {
  @Property(primaryKey = true, desc = "唯一id", handler = SnowIdHandler.class)
  private String id;
  @Property
  private String name;
  private String projectId;

  @Property(type = Type.JsonArray)
  private JSONArray label;

  @Property(type = Type.JSON)
  private JSONObject creater;

  @Property
  private String phone;

  @Property
  private Integer status;

  @Property
  private Float lat;

  @Property
  private Float lon;

  @Property(schema = Project.class, type = Type.LIST, forProperty = "access")
  private List<Project> project;

  @RelationProperty(schema = Access.class, forProperty = "project", point = Type.OUT)
  private Access access;

  @Property(name = "device", schema = Device.class, type = Type.LIST, forProperty = "direct")
  private List<Device> device;

  @Property(handler = DistanceHandler.class, handlerArgs = {"lat", "lon"})
  private Float distance;

  @RelationProperty(name = "direct", schema = Direct.class, point = Type.OUT, forProperty = "device")
  private Direct direct;

  @Property(schema = Room.class, type = Type.LIST, forProperty = "access")
  private List<Room> room;

}
